home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d21 / dvglue10.arc / TVKGETC.C < prev    next >
C/C++ Source or Header  |  1988-08-13  |  1KB  |  39 lines

  1. /*=======================================================*/
  2. /*  TVKGETC.C                                            */
  3. /*                                                       */
  4. /*  (c) Copyright 1988 Ralf Brown                        */
  5. /*     All Rights Reserved                               */
  6. /*  May be freely copied for noncommercial use, so long  */
  7. /*  as this copyright notice remains intact, and any     */
  8. /*  changes are marked in the comment blocks preceding   */
  9. /*  functions.                                           */
  10. /*=======================================================*/
  11.  
  12. #include "tvapi.h"
  13.  
  14. /*=============================================*/
  15. /* TVkbd_getc  wait for next keystroke         */
  16. /*   Ralf Brown 6/10/88                        */
  17. /*=============================================*/
  18.  
  19. int pascal TVkbd_getc(OBJECT kbd)
  20. {
  21.    PARMLIST3 p ;
  22.    int retval ;
  23.  
  24.    p.num_args = 0 ;
  25.    TVsendmsg(READ_MSG, kbd?TOS:ME, kbd, (PARMLIST *)&p) ;
  26.    retval = *((char far *)p.arg[1]) ;
  27.    if (p.arg[1] > 1)  /* were there multiple keystrokes? */
  28.       {               /* yes, write back all but first */
  29.       p.num_args = 3 ;
  30.       p.arg[0]++ ;  /* skip first byte of input */
  31.       p.arg[1]-- ;
  32.       p.arg[2] = (DWORD) TVkbd_status(kbd) ;
  33.       TVsendmsg(WRITE_MSG, kbd?TOS:ME, kbd, (PARMLIST *)&p) ;
  34.       }
  35.    return retval ;
  36. }
  37.  
  38. /* End of TVKGETC.C */
  39.